<%--
  Created by IntelliJ IDEA.
  User: Snakewood
  Date: 2020/12/23
  Time: 16:05
  To change this template use File | Settings | File Templates.
--%>

<%@page import="java.io.BufferedReader"%>
<%@page import="java.io.FileReader"%>
<%@page import="java.io.File"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>零食之家-首页</title>
    <link type="text/css" href="${pageContext.request.contextPath}/css/autoplay.css" rel="stylesheet" />
    <link type="text/css" rel="stylesheet" href="css/leibiebiankuang.css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/autoplay.js"></script>
    <style type="text/css">
      a{text-decoration: none;}
      body{background-color: white;}
      .wrap {        height: 30px;
        overflow: hidden;
        position: absolute;
        top: 30px;
        left: 100px;
        width: 100%
      }

      p {
        margin: 0;
        height: 30px;
        line-height: 30px;
        text-align: center;
        background: #ccc;
        width: 300px;
      }

      .content p {position: absolute;}

      @-webkit-keyframes anim1 {
        0% {
          top: 40px;
          opacity: 1
        }
        50% {
          top: -40px;
          opacity: 1
        }
        75% {
          top: -40px;
          opacity: 0
        }
        100% {
          top: 40px;
          opacity: 0
        }
      }

      @-webkit-keyframes anim2 {
        0% {
          top: -40px;
          opacity: 0
        }
        25% {
          top: 40px;
          opacity: 0
        }
        50% {
          top: 40px;
          opacity: 1
        }
        100% {
          top: -40px;
          opacity: 1
        }
      }
      .content p:nth-child(1) {-webkit-animation: anim1 5s linear infinite;}

      .content p:nth-child(2) {-webkit-animation: anim2 5s linear infinite;}
    </style>

  </head>

  <body class="main">

  <%@include file="head.jsp"%>
  <%@include file="search.jsp"%>
  <%@include file="menu.jsp"%>

  <div id="box_autoplay">
    <div class="list" style="display: table-cell">
      <ul>
        <li><img src="${pageContext.request.contextPath}/picture/l1.jpg" width="890" height="335" /></li>
        <li><img src="${pageContext.request.contextPath}/picture/l2.jpg" width="890" height="335" /></li>
        <li><img src="${pageContext.request.contextPath}/picture/l3.jpg" width="890" height="335" /></li>
        <li><img src="${pageContext.request.contextPath}/picture/l4.jpg" width="890" height="335" /></li>
      </ul>
    </div>
  </div>

<%--  公告栏开始  --%>
  <%

    String path ="D:\\";   // 这边文件目录需改成相对路径
    File file = new File(path,"jsp.txt");
    FileReader fr = new FileReader(file);  //字符输入流
    BufferedReader br = new BufferedReader(fr);  //使文件可按行读取并具有缓冲功能
    StringBuffer strB = new StringBuffer();   //strB用来存储jsp.txt文件里的内容


    String str = br.readLine();
    while(str!=null){
      str="<p>"+str+"</p>";
//      strB.append(str).append("<br>");
      strB.append(str);     //将读取的内容放入strB
      str = br.readLine();
    }
    br.close();    //关闭输入流
    String result = new String(strB.toString().getBytes(),"utf-8");//修改编码格式为utf-8
    //System.out.println(result);
  %>
  <div class="wrap">
    <div class="content">
      <%=result%>
    </div>
  </div>
<%--   公告栏结束   --%>

<%--  <div style="text-align: center">--%>
<%--    <table border="1"     cellspacing="0"    bordercolor="#00CCCC" style="margin: auto">--%>


<%--      <tr>--%>
<%--        <td>序号</td>--%>
<%--        <td>图片</td>--%>
<%--        <td>零食名称</td>--%>
<%--        <td>口味</td>--%>
<%--        <td>价格</td>--%>
<%--        <td>单位</td>--%>
<%--        &lt;%&ndash;            <td>库存</td>&ndash;%&gt;--%>
<%--        <td>操作</td>--%>
<%--      </tr>--%>
<%--      <c:forEach items="${foodList}" var="m" varStatus="s">--%>
<%--        <tr>--%>
<%--          <td>${s.index+1}</td>--%>
<%--          <td><img src="${m.pic}"></td>--%>
<%--          <td>${m.foodname}</td>--%>
<%--          <td>${m.flavor}</td>--%>
<%--          <td>${m.price}</td>--%>
<%--          <td>${m.unit}</td>--%>
<%--            &lt;%&ndash;                <td>${m.stock}</td>&ndash;%&gt;--%>
<%--          <td>--%>
<%--            <a href="food?op=scan&fid=${m.fid}">查看</a>--%>
<%--          </td>--%>
<%--        </tr>--%>
<%--      </c:forEach>--%>
<%--    </table>--%>
<%--  </div>--%>

  </body>
</html>
